/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */
package cn.ex;

/**
 * <p>Project: app2022 - Ex
 * <p>Powered by webrx On 2022-01-11 16:51:32
 *
* @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Ex {
    public static void main(String[] args) {
        Student st = new Student(11,"李四");
        System.out.println("-".repeat(50));
        Student st2 = new Student(12,"王五");
        Student st3 = new Student(16,"王五");
    }
}

class Person{
    private int age = 88;
    {
        System.out.println("Person init....");
    }
    private int id;
    private String name;

    public Person(String name){
        System.out.println("Person(String name)");
        this.name = name;
    }

    public Person(int id){
        this.id = id;
    }

    public Person(int id,String name){
        System.out.println("Person(int id,String name)");
        this.id = id;
        this.name = name;
    }

    public Person(){
        System.out.println("父类Person()");

    }

    static{
        System.out.println("Person static{}");
    }


}

class Student extends Person{
    {
        System.out.println("Person init1....");
    }
    static{
        System.out.println("Student static{}");
    }
    private int id;
    private String name;
    public Student(int id,String name){
        //super(id,name); 如果不写，自动调用super();
        System.out.println("Student(int id,String name)");
        this.id = id;
        this.name = name;
        //System.out.println(super.age);
    }
    {
        System.out.println("Person init2....");
    }
    {
        System.out.println("Person init3....");
    }
}
